#!/bin/bash

src=$(adapt tool get http://www.cise.ufl.edu/research/sparse/SuiteSparse/SuiteSparse-4.2.1.tar.gz)


echo $src

pushd $src

#it builds only the libs, so I do not need lapack and blas
#however, do not know what to do with metis and other. let's see how it evolves

# modify the installation destination dirs
cp SuiteSparse_config/SuiteSparse_config.mk SuiteSparse_config/SuiteSparse_config.mk.bak
# modify the 
adapt_dir=~/adapt/soft
mkdir -p $adapt_dir
adapt_dir_sed=$(echo $adapt_dir | sed 's/\//\\&/g')

sed -i -r "s/(INSTALL_LIB).*/\1 = $adapt_dir_sed\/lib/; s/(INSTALL_INCLUDE).*/\1 = $adapt_dir_sed\/include/" SuiteSparse_config/SuiteSparse_config.mk


make library
make install

popd

